Test if a bit is on

By  Dimitre Novatchev
 
Language  XPath
Category  
Posted 13  June  2001
Updated 13  June  2001
Summary
For hardcore programmers, who may miss this feature in XPath/XSLT, here it is:
 
See the code below:
 
This tests if in an attribute named "Flags" the N+1st bit is on (supposing bits are ordered from right to left).
 
$pow2ToN is the value of 2 to the power of N.
 
Code